<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
   xmlns:f="http://xmlns.jcp.org/jsf/core"
   xmlns:h="http://xmlns.jcp.org/jsf/html"
   xmlns:p="http://primefaces.org/ui"
   xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
   xmlns:pe="http://primefaces.org/ui"
   template="/WEB-INF/templates/business/supplier/template.xhtml">
   
   	<f:metadata>
	   	<f:viewParam name="bulletinId" value="#{bulletinHome3.id}"></f:viewParam>
	   	<f:event listener="#{bulletinHome3.initConversation()}" type="preRenderView"></f:event>
	   	<f:viewParam name="tradeId" value="#{tradeHome.id}"></f:viewParam>
	   	<f:event listener="#{tradeHome.initConversation()}" type="preRenderView"></f:event>
   	</f:metadata>
   	<ui:define name="supplier_head">
   		<style type="text/css">
   			.removeButton {
   				float: right;
   				margin-right: 20px;
   			}
   			.limitUnit{
   				margin-top:5px;
   			}
   			h2{
   				text-align:center
   			}
   			.rowStyle{
	   			text-align: center;
	   			font-size:16px
   			}
   			
   		</style>
   	</ui:define>
   	<ui:define name="supplier_content">
   
		<h:form id="editForm"  >         
			<p:panel id="panel" header="公告信息" style="margin-bottom:10px;">
		       <p:messages id="messages" closable="true"><p:autoUpdate/></p:messages>
		        <ui:include src="/WEB-INF/templates/business/bulletinBasicInfo.xhtml" />
			</p:panel>
		
				<p:panel id="bulletinReqs" header="公告要求">
				<h:panelGrid columns="2" cellpadding="5"
					columnClasses="column1,column2">
					<p:outputLabel for="rootQualificationGroup" value="匹配规则" />
					<h:outputText id="rootQualificationGroup"
						style="font-size:16px;color:red"
						value="#{bulletinHome3.instance.qualificationGroup.relation.typeName}" />
				</h:panelGrid>
				<p:panel id="agentServiceReqs" header="服务事项要求"
					rendered="#{bulletinHome3.instance.qualificationGroup.getAgentServiceGroups().size() > 0}"
					style="margin-bottom:10px;">
					<p:repeat var="_serviceGroup"
						value="#{bulletinHome3.instance.qualificationGroup.getAgentServiceGroups()}"
						varStatus="_groupStatus">
						<p:panelGrid cellpadding="5"
							style=" margin-bottom: 10px;width:100%">
							<p:row style="width:100%">
								<p:column>
									<h2>服务事项要求组#{_groupStatus.index +
										1}（#{_serviceGroup.relation.typeName}组）</h2>
								</p:column>
							</p:row>

							<p:row>
								<p:column>
									<p:panelGrid cellpadding="5" style="width:100%">
										<p:row styleClass="rowStyle">
											<p:column>服务事项名称</p:column>
											<p:column>对应资质大类</p:column>
										</p:row>

										<p:repeat var="_service"
											value="#{_serviceGroup.agentServices}">
											<p:row>
												<p:column>
													<h:outputText value="#{_service.name}" />
												</p:column>
												<p:column>
													<h:outputText value="#{_service.qualificationClass.name}" />
												</p:column>
											</p:row>
										</p:repeat>
									</p:panelGrid>
								</p:column>
							</p:row>
						</p:panelGrid>
					</p:repeat>
				</p:panel>

				<p:panel id="reqs" header="资质要求"
					rendered="#{bulletinHome3.instance.qualificationGroup.getQualificationGroups().size () > 0}"
					style="margin-bottom:10px;">
					<h:outputText
						value="#{bulletinHome3.instance.qualificationGroup.getQualificationGroupDetail()}" />
				</p:panel>
				
				<p:panel header="公告要求材料">
						<p:dataList var="_req" value="#{tradeHome.instance.requirements}">
							<h3 style="padding:5px;">#{_req.requirementDefination.requiredName}</h3>
							<p:dataList var="_attr" value="#{_req.attachments}" varStatus="_status">
								<li style="border:none;padding:5px;text-indent:2em;">
									<p:commandLink value="#{_status.index + 1}、#{_attr.filename}" ajax="false" >
								        <p:fileDownload value="#{attachments.attr}">
								        	<f:param name="id" value="#{_attr.id}"></f:param>
								        </p:fileDownload>
								        <f:param name="id" value="#{_attr.id}"></f:param>
								    </p:commandLink>
								</li>
							</p:dataList>
						</p:dataList>
				</p:panel>
				
			</p:panel>
			
			<p:commandButton action="#{tradeHome.cancelApply()}" value="取消报名" rendered="#{tradeHome.instance.supplierCanCancel()}">
				<p:confirm header="请确认" message="您确认取消报名吗?" icon="ui-icon-alert" />
			</p:commandButton>
			
			<p:confirmDialog width="300" id="confirmDialog" global="true" showEffect="fade" hideEffect="explode" widgetVar="confirmDialog">
			    <p:commandButton value="确认" styleClass="ui-confirmdialog-yes"></p:commandButton>
			    <p:commandButton value="取消" immediate="true" styleClass="ui-confirmdialog-no" />
			</p:confirmDialog>
		</h:form>
		
		
   	</ui:define>
</ui:composition>
